]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay: Save pages after dropping
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Tue, 26 May 2020 04:41:17 +0000 (01:41 -0300)
committerFlorian Müllner <florian.muellner@gmail.com>
Mon, 20 Jul 2020 16:13:20 +0000 (16:13 +0000)
Save the icon grid layout after dropping, and only in
that moment.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284

js/ui/appDisplay.js

index fee6967ce5668c6f38190c837522fd9b4c5c570b..01df5afe6de63a4408c2b9aafafcb9e7528904c3 100644 (file)
@@ -730,6 +730,25 @@ class AppDisplay extends BaseAppView {
         super._redisplay();
     }
 
+    _savePages() {
+        const pages = [];
+
+        for (let i = 0; i < this._grid.nPages; i++) {
+            const pageItems =
+                this._grid.getItemsAtPage(i).filter(c => c.visible);
+            const pageData = {};
+
+            pageItems.forEach((item, index) => {
+                pageData[item.id] = {
+                    position: GLib.Variant.new_int32(index),
+                };
+            });
+            pages.push(pageData);
+        }
+
+        this._pageManager.pages = pages;
+    }
+
     _itemNameChanged(item) {
         // If an item's name changed, we can pluck it out of where it's
         // supposed to be and reinsert it where it's sorted.
@@ -1070,6 +1089,8 @@ class AppDisplay extends BaseAppView {
             this._removeDelayedMove();
         }
 
+        this._savePages();
+
         let view = _getViewFromIcon(source);
         if (view instanceof FolderView)
             view.removeApp(source.app);